/*
 * @Author: NaturalHulk 2066634567@qq.com
 * @Date: 2024-02-18 11:33:13
 * @LastEditors: NaturalHulk 2066634567@qq.com
 * @LastEditTime: 2024-02-23 17:31:40
 * @FilePath: /umi_demo/src/api/system/role.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from "@/utils/request";

// 查询角色管理列表
export function GetListAPI(params: object) {
  return request({
    url: "/system/role/list",
    method: "GET",
    params,
  });
}

//更改状态
export function UpdateStatusAPI(data: object) {
  return request({
    url: "/system/role/changeStatus",
    method: "PUT",
    data,
  });
}

//获取树结构数据
export function GetMenuListAPI(params: object) {
  return request({
    url: "/system/menu/list",
    method: "GET",
    params,
  });
}

//新增
export function AddDataAPI(data: object) {
  return request({
    url: "/system/role",
    method: "POST",
    data,
  });
}

/**
 * 修改
 * @param {*} data
 * @returns
 */
export function EditDataAPI(data: object) {
  return request({
    url: "/system/role",
    method: "PUT",
    data,
  });
}

/**
 * 详情 单条数据
 * @param {id} data
 * @returns
 */
export function GetViewAPI(data: string) {
  return request({
    url: "/system/role/" + data,
    method: "GET",
  });
}
//删除
export function DelDataAPI(data: string) {
  return request({
    url: "/system/role/" + data,
    method: "DELETE",
  });
}

//查询角色已授权用户列表
export function allocatedUserList(query: string) {
  return request({
    url: "/system/role/authUser/allocatedList",
    method: "get",
    params: query,
  });
}

//数据权限
export function dataScopeSApi(data) {
  return request({
    url: "/system/role/dataScope",
    method: "PUT",
    data,
  });
}
